<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>系统参数</title>
    <% include("../../common/css.html"){} %>
    <style>
        .config-text {
            background-color: #3F3F3F;
            color: #eee;
            font-size: 12px;
            font-family: Courier New;
        }
    </style>
</head>

<body>
<% include("../../layout/loading.html"){} %>
<!-- 正文开始 -->
<div class="layui-fluid">
    <form class="layui-form model-form">
        <input name="id" type="hidden" value="${conf.id}"/>
        <input name="appId" type="hidden" value="${conf.appId}"/>
        <div class="layui-row">
            <div class="layui-col-xs6">
                <div class="layui-form-item">
                    <label class="layui-form-label">参数名称</label>
                    <div class="layui-input-block">
                        <input name="title" placeholder="请输入参数名称" type="text" class="layui-input" maxlength="200" value="${conf.title}"
                               lay-verType="tips" lay-verify="required" required/>
                    </div>
                </div>
            </div>
            <div class="layui-col-xs6">
                <div class="layui-form-item">
                    <label class="layui-form-label">参数键名</label>
                    <div class="layui-input-block">
                        <input name="confKey" placeholder="请输入参数键名" type="text" class="layui-input" maxlength="200" value="${conf.confKey}"
                               lay-verType="tips" lay-verify="required" required/>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">参数键值</label>
            <div class="layui-input-block">
                <input name="confValue" id="confValue" placeholder="请输入参数键值..." value="${conf.confValue}" type="text" class="layui-input config-text" maxlength="200"
                       lay-verType="tips" lay-verify="required" required/>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入备注信息" name="remark" class="layui-textarea" lay-verType="tips" lay-verify="required">${conf.remark}</textarea>
            </div>
        </div>

        <div class="layui-form-item text-right layui-footer" style="left: 0;">
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
            <button class="layui-btn" lay-filter="configSubmit" lay-submit>保存</button>
        </div>
    </form>
</div>

<!-- js部分 -->
<% include("../../common/js.html"){} %>
<script>
    layui.use(['layer', 'form', 'util', 'admin'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var admin = layui.admin;

        // 表单提交事件
        form.on('submit(configSubmit)', function (data) {
            layer.load(2);
            var url = '/system/config/update';
            data.field.content = document.getElementById("confValue").value;
            $.post(url, data.field, function (res) {
                layer.closeAll('loading');
                if (res.code == 200) {
                    layer.msg(res.msg);
                    admin.closeThisDialog();
                    parent.layui.table.reload('configTable');
                } else {
                    layer.msg(res.msg, {icon: 2});
                }
            }, 'json');
            return false;
        });



    });
</script>


</body>
</html>